// -*- C++ -*-
-// $Id: babeldata.h,v 1.5 2010/02/15 02:57:00 robertl Exp $
+// $Id: babeldata.h,v 1.6 2010/04/11 18:11:46 robertl Exp $
//------------------------------------------------------------------------
//
// Copyright (C) 2009 S. Khai Mong <khai@mangrai.com>.
upgradeCheckTime(QDateTime(QDate(2001, 1, 1), QTime(0, 0))),
installationUuid(QUuid::createUuid().toString()),
startupVersionCheck(true),
- reportStatistics(true)
+ reportStatistics(true),
+ allowBetaUpgrades(false)
{
};
// Global preferences.
sg.addVarSetting(new BoolSetting("app.startupVersionCheck", startupVersionCheck));
sg.addVarSetting(new BoolSetting("app.reportStatistics", reportStatistics));
+ sg.addVarSetting(new BoolSetting("app.allowBetaUpgrades", allowBetaUpgrades));
}
// Global preferences.
bool startupVersionCheck;
bool reportStatistics;
+ bool allowBetaUpgrades;
};
// -*- C++ -*-
-// $Id: mainwindow.cpp,v 1.17 2010/02/16 02:49:43 robertl Exp $
+// $Id: mainwindow.cpp,v 1.18 2010/04/11 18:11:47 robertl Exp $
//------------------------------------------------------------------------
//
// Copyright (C) 2009 S. Khai Mong <khai@mangrai.com>.
const int BabelData::fileType = 0;
const int BabelData::deviceType = 1;
//------------------------------------------------------------------------
-static QString findBabelVersion()
+QString MainWindow::findBabelVersion()
{
QProcess babel;
babel.start("gpsbabel", QStringList() << "-V");
return QString();
QString str = babel.readAll();
+ is_beta = str.contains("-beta");
str.replace(QRegExp("^[\\s]*"), "");
str.replace(QRegExp("[\\s]+$"), "");
return str;
}
+
+//------------------------------------------------------------------------
+// Decides whether available beta upgrades are suggested to user for download.
+bool MainWindow::allowBetaUpgrades()
+{
+ // If this is a beta version (which means the user consciously downloaded
+ // it and decided to be on the beta track or the user has ticked the
+ // 'suggest beta upgrade' box, allow betas to be suggested for installation.
+ return is_beta || bd.allowBetaUpgrades;
+}
+
//------------------------------------------------------------------------
static QStringList getCharSets()
{
if (bd.startupVersionCheck) {
upgrade->checkForUpgrade(babelVersion, bd.upgradeCheckMethod,
bd.upgradeCheckTime, bd.installationUuid,
- bd.reportStatistics);
+ bd.reportStatistics, allowBetaUpgrades());
}
}
void MainWindow::upgradeCheckActionX()
{
upgrade->checkForUpgrade(babelVersion, bd.upgradeCheckMethod,
- QDateTime(), bd.installationUuid,
- bd.reportStatistics);
+ QDateTime(QDate(2000, 1, 1), QTime(0, 0)),
+ bd.installationUuid,
+ bd.reportStatistics, allowBetaUpgrades());
}
//------------------------------------------------------------------------
// -*- C++ -*-
-// $Id: mainwindow.h,v 1.9 2010/02/16 02:49:43 robertl Exp $
+// $Id: mainwindow.h,v 1.10 2010/04/11 18:11:47 robertl Exp $
//------------------------------------------------------------------------
//
// Copyright (C) 2009 S. Khai Mong <khai@mangrai.com>.
Ui_MainWindow ui;
QList<Format> formatList;
QString babelVersion;
+ bool is_beta;
QPixmap lights[4];
QStringList charSets;
AllFiltersData filterData;
void loadFormats();
QString filterForFormat(int idx);
QString ensureExtensionPresent(const QString &nanme, int idx);
+ QString findBabelVersion();
bool filterForFormatIncludes(int idx, const QString &s);
int formatIndexFromName(bool isFile, const QString &);
QList<int>inputFileFormatIndices();
void setWidgetValues();
void getWidgetValues();
UpgradeCheck *upgrade;
+ bool allowBetaUpgrades();
void osLoadDeviceNameCombos(QComboBox*);
protected:
// -*- C++ -*-
-// $Id: upgrade.cpp,v 1.23 2010/02/23 15:38:26 robertl Exp $
+// $Id: upgrade.cpp,v 1.24 2010/04/11 18:11:47 robertl Exp $
/*
Copyright (C) 2009, 2010 Robert Lipe, robertlipe@gpsbabel.org
int checkMethod,
const QDateTime &lastCheckTime,
const QString &installationUuid,
- bool reportStatistics)
+ bool reportStatistics,
+ bool allowBeta)
{
currentVersion = currentVersionIn;
currentVersion.remove("GPSBabel Version ");
args += "&cpu=" + QString(utsname.machine);
}
#endif
+
args += "&os_ver=" + getOsVersion();
- args += "&beta_ok=1"; // Eventually to come from prefs.
+ args += QString("&beta_ok=%1").arg(allowBeta);
args += "&lang=" + QLocale::languageToString(locale.language());
args += "&last_checkin=" + lastCheckTime.toString(Qt::ISODate);
int upgradeCheckMethod,
const QDateTime &lastCheckTime,
const QString &installationUuid,
- bool reportStatistics
+ bool reportStatistics,
+ bool allowBeta
);
QDateTime getUpgradeWarningTime() {
return upgradeWarningTime;